/**
 * http://usejsdoc.org/
 * @Server dgram.createSocket 
 */
var dgram = require('dgram'),
	server = dgram.createSocket("udp4");

/** socket 监听 message 消息事件**/
server.on("message",function(msg,rinfo){
	console.log("server get "+ msg + " from " + rinfo.address + ":" + rinfo.port);
	var message = new Buffer("server get message for client");
	server.send(message,rinfo.port,rinfo.address);
});

/** socket 监听 listening 事件**/
server.on("listening",function(){
	var address = server.address();
	console.log("server listening "+address.address + ":" + address.port);
});
/**绑定并开始监听端口，启动UDP SOCKET*/
server.bind(41234);
//server.bind({
//	  address: '127.0.0.0',
//	  port: 8080,
//	  exclusive: true
//});
